

import { Commit } from "vuex"

const state: any = {
    accessToken: "token is test ",
    username: '',
    avatar: ''
}
const getters: any = {
    accessToken: (state: any) => state.accessToken,
    username: (state: any) => state.username,
    avatar: (state: any) => state.avatar
}




const mutations: any = {
    setUsername(state: any, params: object) {
        state.username = params
    },
    setAvatar(state: any, params: object) {
        state.avatar = params
    }
}

const actions: any = {
    setUsernameAc(context: {commit: Commit}, params: object) {
        context.commit("setUsername", params)
    },
    /**
     * 设置虚拟角色
     * @param context 
     */
    setVirtualRoles(context: {commit: Commit}) {
        context.commit("setAvatar", "https://i.gtimg.cn/club/item/face/img/2/15922_100.gif")
        context.commit("setUsername", "admin11111111111")
    } 
}

export default {state, getters, mutations, actions}